package SC12Project.pm2.publish;

import java.rmi.RemoteException;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.uddi.v3_service.DispositionReportFaultMessage;

import SC12Project.pm2.Strings.GlobalStrings;

public class PublishService
{

    private static Logger logger = Logger.getLogger( PublishService.class );

    public static void main( String[] args )
    {
        BasicConfigurator.configure();

        JuddiClient juddiClient = new JuddiClient();
        juddiClient.initilize();
        try
        {
            juddiClient.serverLogin( GlobalStrings.GROUP_NAME, GlobalStrings.GRPSSWD );
            juddiClient.publishService( "WeatherService", GlobalStrings.WEATHER_SERVICE_DESCRIPTION,
                                        GlobalStrings.WEATHER_LIVE_URL );
            logger.info( "WeatherService has been published" );
            juddiClient.publishService( "WarehouseService", GlobalStrings.WAREHOUSE_SERVICE_DESCRIPTION,
                                        GlobalStrings.WAREHOUSE_LIVE_URL );
            logger.info( "WarehouseService has been published" );
            juddiClient.publishService( "PaymentService", GlobalStrings.PAYMENT_SERVICE_DESCRIPTION,
                                        GlobalStrings.PAYMENT_LIVE_URL );
            logger.info( "PaymentService has been published" );
        }
        catch ( DispositionReportFaultMessage e )
        {
            e.printStackTrace();
        }
        catch ( RemoteException e )
        {
            e.printStackTrace();
        }
    }
}
